-- the debug mode
if is_mode("debug") then
    
    -- enable the debug symbols
    set_symbols("debug")

    -- disable optimization
    set_optimize("none")
end

-- the release mode
if is_mode("release") then

    -- set the symbols visibility: hidden
    set_symbols("hidden")

    -- enable fastest optimization
    set_optimize("fastest")

    -- strip all symbols
    set_strip("all")
end

-- add target
target("test1")

    -- set kind
    set_kind("binary")

    add_includedirs("inc", "inc/sdl", "inc/ffmpeg")

    add_linkdirs("lib/sdl/$(arch)")
    add_linkdirs("lib/ffmpeg/$(arch)")
    add_linkdirs("lib/dzlua/$(arch)")

    add_links("SDL2", "SDL2main", "SDL2_ttf")
    add_links("avcodec", "avdevice", "avformat", "avfilter")
    add_links("swscale", "swresample", "postproc", "avutil")
    add_links("dzlua")

    add_defines("SDL_MAIN_HANDLED")

    -- add files
    add_files("src/test1/*.cpp") 

target_end()

-- add target
target("audio")

    -- set kind
    set_kind("binary")

    add_includedirs("inc", "inc/sdl", "inc/ffmpeg")

    add_linkdirs("lib/sdl/$(arch)")
    add_linkdirs("lib/ffmpeg/$(arch)")
    add_linkdirs("lib/dzlua/$(arch)")

    add_links("SDL2", "SDL2main", "SDL2_ttf")
    add_links("avcodec", "avdevice", "avformat", "avfilter")
    add_links("swscale", "swresample", "postproc", "avutil")
    add_links("dzlua")

    add_defines("SDL_MAIN_HANDLED")

    -- add files
    add_files("src/audio/*.cpp") 

target_end()

------------------------------
-- add target
target("test_decoder")

    -- set kind
    set_kind("binary")

    add_includedirs("inc", "inc/sdl", "inc/ffmpeg")

    add_linkdirs("lib/sdl/$(arch)")
    add_linkdirs("lib/ffmpeg/$(arch)")
    add_linkdirs("lib/dzlua/$(arch)")

    add_links("SDL2", "SDL2main", "SDL2_ttf")
    add_links("avcodec", "avdevice", "avformat", "avfilter")
    add_links("swscale", "swresample", "postproc", "avutil")
    add_links("dzlua")

    add_defines("SDL_MAIN_HANDLED")

    -- add files
    add_files("src/player/decoder/*.cpp")
    add_files("src/player/test_decoder.cpp")

    add_cxflags("-EHsc")

target_end()

-- add target
target("test_player")

    -- set kind
    set_kind("binary")

    add_includedirs("inc", "inc/sdl", "inc/ffmpeg")

    add_linkdirs("lib/sdl/$(arch)")
    add_linkdirs("lib/ffmpeg/$(arch)")
    add_linkdirs("lib/dzlua/$(arch)")

    add_links("SDL2", "SDL2main", "SDL2_ttf")
    add_links("avcodec", "avdevice", "avformat", "avfilter")
    add_links("swscale", "swresample", "postproc", "avutil")
    add_links("dzlua")

    add_defines("SDL_MAIN_HANDLED")

    -- add files
    add_files("src/player/decoder/*.cpp") 
    add_files("src/player/player/*.cpp") 
    add_files("src/player/test_player.cpp")

    add_cxflags("-EHsc")

target_end()

-- add target
target("test_pcm")

    -- set kind
    set_kind("binary")

    add_includedirs("inc", "inc/sdl", "inc/ffmpeg")

    add_linkdirs("lib/sdl/$(arch)")
    add_linkdirs("lib/ffmpeg/$(arch)")
    add_linkdirs("lib/dzlua/$(arch)")

    add_links("SDL2", "SDL2main", "SDL2_ttf")
    add_links("avcodec", "avdevice", "avformat", "avfilter")
    add_links("swscale", "swresample", "postproc", "avutil")
    add_links("dzlua")

    add_defines("SDL_MAIN_HANDLED")

    -- add files
    add_files("src/player/decoder/*.cpp")
    add_files("src/player/test_pcm.cpp")

    add_cxflags("-EHsc")

target_end()

-- add target
target("test_edplayer")

    -- set kind
    set_kind("binary")

    add_includedirs("inc", "inc/edui", "inc/ffmpeg")

    add_linkdirs("lib/edui/$(arch)")
    add_linkdirs("lib/ffmpeg/$(arch)")
    add_linkdirs("lib/dzlua/$(arch)")

    add_links("edui")
    add_links("avcodec", "avdevice", "avformat", "avfilter")
    add_links("swscale", "swresample", "postproc", "avutil")
    add_links("dzlua")

    add_defines("SDL_MAIN_HANDLED")

    -- add files
    add_files("src/player/decoder/*.cpp") 
    add_files("src/player/edplayer/*.cpp")
    add_files("src/player/test_edplayer.cpp")

    add_cxflags("-EHsc")

target_end()

-- add target
target("testsdl")

    -- set kind
    set_kind("binary")

    add_includedirs("inc", "inc/edui", "inc/sdl")

    add_linkdirs("lib/edui/$(arch)")
    add_linkdirs("lib/dzlua/$(arch)")
    add_linkdirs("lib/sdl/$(arch)")

    add_links("edui")
    add_links("dzlua")
    add_links("SDL2", "SDL2main", "SDL2_ttf", "SDL2_image")

    add_defines("SDL_MAIN_HANDLED")

    add_cxflags("-EHsc")

    add_files("src/testsdl/*.cpp") 

target_end()